﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="realizarMatricula.aspx.cs"
    Inherits="sistemaAcademicoFinanceiroEscolas.realizarMatricula" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Realizar Matrícula</title>
    <link href="Site2.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .style1
        {
            font-family: Verdana, Arial, Helvetica, sans-serif;
            font-size: 12px;
            font-style: normal;
            color: #000000;
            text-decoration: none;
            width: 83%;
        }
        .style2
        {
            width: 175px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:Label ID="lblValidacao" runat="server" ForeColor="Red" CssClass="style1"></asp:Label>
    <table width="100%" border="0">
        <tr>
            <td class="style2">
                <img src="images/setadireita.gif" width="16" height="14" />
            </td>
            <td class="style1">
                Aluno
            </td>
            <td width="14%">
                <asp:Label CssClass="style1" ID="lblNomeAluno" runat="server" Text="Label"></asp:Label>
            </td>
        </tr>
        <tr>
            <td colspan="5%">
                <img src="images/linhaDivPops.gif" width="250" height="8" />
            </td>
        </tr>
        <tr>
            <td class="style2">
                <img src="images/setadireita.gif" width="16" height="14" />
            </td>
            <td class="style1">
                Ano Letivo
            </td>
            <td width="14%">
                <asp:DropDownList ID="lstAnoLetivo" runat="server" AutoPostBack="True" OnSelectedIndexChanged="lstAnoLetivo_SelectedIndexChanged">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td colspan="2%">
                <img src="images/linhaDivPops.gif" width="250" height="8" />
            </td>
        </tr>
        <tr>
            <td class="style2">
                <img src="images/setadireita.gif" width="16" height="14" />
            </td>
            <td class="style1">
                Série
            </td>
            <td width="14%">
                <asp:DropDownList ID="lstSerie" runat="server">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td colspan="2%">
                <img src="images/linhaDivPops.gif" width="250" height="8" />
            </td>
        </tr>
        <tr>
            <td class="style2">
                <img src="images/setadireita.gif" width="16" height="14" />
            </td>
            <td class="style1">
                Modalidade de aula
            </td>
            <td width="14%">
                <asp:DropDownList ID="lstModalidade" runat="server">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td colspan="2%">
                <img src="images/linhaDivPops.gif" width="250" height="8" />
            </td>
        </tr>
        <tr>
            <td class="style2">
                <img src="images/setadireita.gif" width="16" height="14" />
            </td>
            <td class="style1">
                Dia do pagamento
            </td>
            <td width="14%">
                <asp:DropDownList ID="lstDiaPagamento" runat="server">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td colspan="2%">
                <img src="images/linhaDivPops.gif" width="250" height="8" />
            </td>
        </tr>
        <tr>
            <td class="style2">
                <img src="images/setadireita.gif" width="16" height="14" />
            </td>
            <td class="style1">
                Tipo do pagamento
            </td>
            <td width="14%">
                <asp:DropDownList ID="lstTipoPagamento" runat="server">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td colspan="2%">
                <img src="images/linhaDivPops.gif" width="250" height="8" />
            </td>
        </tr>
        <tr>
            <td class="style2">
                <img src="images/setadireita.gif" width="16" height="14" />
            </td>
            <td class="style1">
                Forma de pagamento
            </td>
            <td width="14%">
                <asp:DropDownList ID="lstFormaPagamento" runat="server">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td colspan="2%">
                <img src="images/linhaDivPops.gif" width="250" height="8" />
            </td>
        </tr>
        <tr>
            <td class="style2">
                <img src="images/setadireita.gif" width="16" height="14" />
            </td>
            <td class="style1">
                Observações
            </td>
            <td width="14%">
                <asp:TextBox ID="txtObservacoes" runat="server" TextMode="MultiLine"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td colspan="2%">
                <img src="images/linhaDivPops.gif" width="250" height="8" />
            </td>
        </tr>
        <tr>
            <td class="style2">
                <img src="images/setadireita.gif" width="16" height="14" />
            </td>
            <td class="style1">
                Disciplinas
            </td>
            <td width="14%">
                &nbsp;
            </td>
        </tr>
        <%--Abertura da conexão--%>
        <%
            
            System.Data.SqlClient.SqlConnection sqld = new System.Data.SqlClient.SqlConnection(ConfigurationManager.AppSettings["baseDados"]);
            sqld.Open();

            string sql = "select * from disciplina";

            System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(sql, sqld);
            System.Data.SqlClient.SqlDataReader dr = cmd.ExecuteReader();

            string codigoDisciplina = "";
            string descricaoDisciplina = "";  //criada 2 variaveis para recebimento dos dados

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    codigoDisciplina = dr["codigoDisciplina"].ToString();
                    descricaoDisciplina = dr["descricaoDisciplina"].ToString();  //to string(conversão)
                    
        %><tr>
            <td class="style2">
                <input type="checkbox" name="<%=codigoDisciplina %>" value="<%=codigoDisciplina %>"><%=descricaoDisciplina%>
            </td>
            <td class="style2">
                Data inicial <input type="text" name="<%=codigoDisciplina %>dataInicial" value="">
            </td>
            <td class="style2">
                Data final <input type="text" name="<%=codigoDisciplina %>dataFinal" value="">
            </td>
        </tr>
        <%  
            }
                }

                dr.Close();
                cmd.Dispose();
                sqld.Close();
        
            
        %>
    </table>
    <asp:Panel ID="Panel1" runat="server" Width="400px" Height="0px">
        <asp:HiddenField ID="codigoAluno" runat="server" />
    </asp:Panel>

    <script language="JavaScript">

        function matriculaRealizada() {
            alert('Matrícula realizada com sucesso.')
            window.close();
        }

    </script>

    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Realizar Matrícula" />
    <asp:Panel ID="Panel2" runat="server">
    </asp:Panel>
    </form>
</body>
</html>
